package com.niit.session12;

public class Test {
	public static void main(String[] args) {
		Student student = new Student("小王",20);
		register(student);
		Teacher teacher = new Teacher("张爱国",40);
		register(teacher);
	}
	//注册方法,如果在形参里定义里一个类来接收参数，就说明这个方法可以接收这个类所有的子类，这就是多态
	public static void register(Person p) {
		p.show();
	}

}
